﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Load components from xml</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>

<body>
<H2 
style="FONT-SIZE: 1.6em; MARGIN: 30px 0px 0px; WORD-SPACING: 0px; TEXT-TRANSFORM: none; COLOR: rgb(51,51,51); TEXT-INDENT: 0px; LINE-HEIGHT: 1.2em; FONT-STYLE: normal; FONT-FAMILY: 'Droid Sans', 'Lucida Grande', Verdana, Arial, sans-serif; WHITE-SPACE: normal; LETTER-SPACING: normal; TEXT-ALIGN: left; FONT-VARIANT: normal; TEXT-DECORATION: none; orphans: 2; widows: 2; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"> 
 Load components from xml</H2>
<H4 
style="FONT-SIZE: 1.6em; MARGIN: 30px 0px 0px; WORD-SPACING: 0px; TEXT-TRANSFORM: none; COLOR: rgb(51,51,51); TEXT-INDENT: 0px; LINE-HEIGHT: 1.2em; FONT-STYLE: normal; FONT-FAMILY: 'Droid Sans', 'Lucida Grande', Verdana, Arial, sans-serif; WHITE-SPACE: normal; LETTER-SPACING: normal; TEXT-ALIGN: left; FONT-VARIANT: normal; TEXT-DECORATION: none; orphans: 2; widows: 2; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><FONT face=Courier>Inflating the view from compiled 
XML</FONT> 
    </H4>
<H2 
style="FONT-SIZE: 1.6em; MARGIN: 30px 0px 0px; WORD-SPACING: 0px; TEXT-TRANSFORM: none; COLOR: rgb(51,51,51); TEXT-INDENT: 0px; LINE-HEIGHT: 1.2em; FONT-STYLE: normal; FONT-FAMILY: 'Droid Sans', 'Lucida Grande', Verdana, Arial, sans-serif; WHITE-SPACE: normal; LETTER-SPACING: normal; TEXT-ALIGN: left; FONT-VARIANT: normal; TEXT-DECORATION: none; orphans: 2; widows: 2; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><SPAN 
style="FONT-WEIGHT: normal; FONT-SIZE: 13px">Here’s the code in XML (of 
buttons.xml in /res/layouts) to create one of these buttons, since you can’t set 
the style in Java code easily:</SPAN></H2><PRE class=csharpcode style="BORDER-RIGHT: rgb(153,153,153) 1px dashed; PADDING-RIGHT: 5px; BORDER-TOP: rgb(153,153,153) 1px dashed; OVERFLOW-Y: auto; PADDING-LEFT: 5px; OVERFLOW-X: auto; PADDING-BOTTOM: 5px; WORD-SPACING: 0px; FONT: 10pt 'Lucida Sans Typewriter', Consolas, 'Courier New', Courier, Fixed; TEXT-TRANSFORM: none; BORDER-LEFT: rgb(153,153,153) 1px dashed; WIDTH: 740px; COLOR: rgb(51,51,51); TEXT-INDENT: 0px; PADDING-TOP: 5px; BORDER-BOTTOM: rgb(153,153,153) 1px dashed; LETTER-SPACING: normal; BACKGROUND-COLOR: rgb(247,247,247); TEXT-ALIGN: left; orphans: 2; widows: 2; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><SPAN class=kwrd style="COLOR: rgb(0,0,255)">&lt;?</SPAN><SPAN class=html style="COLOR: rgb(128,0,0)">xml</SPAN> <SPAN class=attr style="COLOR: rgb(255,0,0)">version</SPAN><SPAN class=kwrd style="COLOR: rgb(0,0,255)">="1.0"</SPAN> <SPAN class=attr style="COLOR: rgb(255,0,0)">encoding</SPAN><SPAN class=kwrd style="COLOR: rgb(0,0,255)">="utf-8"</SPAN>?<SPAN class=kwrd style="COLOR: rgb(0,0,255)">&gt;</SPAN>
<SPAN class=rem style="COLOR: rgb(0,128,0)">&lt;!-- the android:id stuff is optional --&gt;</SPAN>
<SPAN class=rem style="COLOR: rgb(0,128,0)">&lt;!-- the button styles are from here - </SPAN>
<SPAN class=rem style="COLOR: rgb(0,128,0)">  http://code.google.com/android/samples/ApiDemos/res/layout/buttons_1.html --&gt;</SPAN>

<SPAN class=kwrd style="COLOR: rgb(0,0,255)">&lt;</SPAN><SPAN class=html style="COLOR: rgb(128,0,0)">Button</SPAN> <SPAN class=attr style="COLOR: rgb(255,0,0)">xmlns:android</SPAN><SPAN class=kwrd style="COLOR: rgb(0,0,255)">="http://schemas.android.com/apk/res/android"</SPAN>
        <SPAN class=attr style="COLOR: rgb(255,0,0)">android:id</SPAN><SPAN class=kwrd style="COLOR: rgb(0,0,255)">="@+id/button_small_left"</SPAN>
        <SPAN class=attr style="COLOR: rgb(255,0,0)">style</SPAN><SPAN class=kwrd style="COLOR: rgb(0,0,255)">="?android:attr/buttonStyleSmall"</SPAN>
        <SPAN class=attr style="COLOR: rgb(255,0,0)">android:text</SPAN><SPAN class=kwrd style="COLOR: rgb(0,0,255)">="Press to close"</SPAN>
    <SPAN class=kwrd style="COLOR: rgb(0,0,255)">/&gt;</SPAN></PRE>
<P 
style="WORD-SPACING: 0px; FONT: 14px/20px 'Droid Sans', 'Segoe UI', 'Lucida Grande', Verdana, Arial, sans-serif; TEXT-TRANSFORM: none; COLOR: rgb(51,51,51); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; TEXT-ALIGN: left; orphans: 2; widows: 2; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px">Here’s the 
Java code to create one of these buttons :</P><PRE class=csharpcode style="BORDER-RIGHT: rgb(153,153,153) 1px dashed; PADDING-RIGHT: 5px; BORDER-TOP: rgb(153,153,153) 1px dashed; OVERFLOW-Y: auto; PADDING-LEFT: 5px; OVERFLOW-X: auto; PADDING-BOTTOM: 5px; WORD-SPACING: 0px; FONT: 10pt 'Lucida Sans Typewriter', Consolas, 'Courier New', Courier, Fixed; TEXT-TRANSFORM: none; BORDER-LEFT: rgb(153,153,153) 1px dashed; WIDTH: 740px; COLOR: rgb(51,51,51); TEXT-INDENT: 0px; PADDING-TOP: 5px; BORDER-BOTTOM: rgb(153,153,153) 1px dashed; LETTER-SPACING: normal; BACKGROUND-COLOR: rgb(247,247,247); TEXT-ALIGN: left; orphans: 2; widows: 2; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px">  Button b = (Button) activity.getViewInflate().inflate(R.layout.buttons,
                                                        <SPAN class=kwrd style="COLOR: rgb(0,0,255)">null</SPAN>,
                                                        <SPAN class=kwrd style="COLOR: rgb(0,0,255)">null</SPAN>);</PRE>
<P>------------------- cách này xưa rồi , bây giờ chỉ dùng&nbsp;được&nbsp;view thôi 
-----------------------</P>
<P>&nbsp;</P></body>
</html>
